﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JobbJakt;

namespace JobbJaktWeb
{
    public partial class AddAdvertisement : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Advertisement advert = new Advertisement();
            advert.Active = true;
            advert.Category = TextBoxCategory.Text;
            advert.Qualifications = TextBoxQualifications.Text;
            advert.CompanyContactID = int.Parse(TextBoxCompanyID.Text);
            advert.Description = TextBoxDescription.Text;
            advert.Title = TextBoxTitle.Text;
            advert.Salary = int.Parse(TextBoxSalary.Text);
            advert.TypeOfEmployment = 0;
            advert.Position = TextBoxPosition.Text;
            advert.RegistrationDate = DateTime.Now;
            advert.ExpirationDate = DateTime.Now.AddMonths(2);
            Advertisement.AddAdvertisement(advert);
            Response.Redirect("AvailableJobs1.aspx");
        }
    }
}